
import { isNullObject } from "@/utils/utils";

//类型：申请成功
export const USER_STATE_REQ_SUCCESS = "USER_STATE_REQ_SUCCESS"

//类型：申请失败
export const USER_STATE_REQ_FAIL = "USER_STATE_REQ_FAIL"

//类型：清空请求
export const USER_STATE_REQ_CLEAR = "USER_STATE_REQ_CLEAR"

//类型：启动页-申请成功
export const LAUNCH_USER_STATE_REQ_SUCCESS = "LAUNCH_USER_STATE_REQ_SUCCESS"

//类型：启动页-申请失败
export const LAUNCH_USER_STATE_REQ_FAIL = "LAUNCH_USER_STATE_REQ_FAIL"

//类型：启动页-申请成功
export const LAUNCH_REFERRER_USER_STATE_REQ_SUCCESS = "LAUNCH_REFERRER_USER_STATE_REQ_SUCCESS"

//类型：启动页-申请失败
export const LAUNCH_REFERRER_USER_STATE_REQ_FAIL = "LAUNCH_REFERRER_USER_STATE_REQ_FAIL"

//类型：登录页-申请成功
export const LOGIN_USER_STATE_REQ_SUCCESS = "LOGIN_USER_STATE_REQ_SUCCESS"

//类型：登录页-申请失败
export const LOGIN_USER_STATE_REQ_FAIL = "LOGIN_USER_STATE_REQ_FAIL"

//类型：首页-申请成功
export const HOME_USER_STATE_REQ_SUCCESS = "HOME_USER_STATE_REQ_SUCCESS"

//类型：首页-申请失败
export const HOME_USER_STATE_REQ_FAIL = "HOME_USER_STATE_REQ_FAIL"

//类型：认证页-申请成功
export const PROOF_USER_STATE_REQ_SUCCESS = "PROOF_USER_STATE_REQ_SUCCESS"

//类型：认证页-申请失败
export const PROOF_USER_STATE_REQ_FAIL = "PROOF_USER_STATE_REQ_FAIL"

//类型：认证页-号码-申请成功
export const PROOF_MOBILE_USER_STATE_REQ_SUCCESS = "PROOF_MOBILE_USER_STATE_REQ_SUCCESS"

//类型：认证页-号码-申请失败
export const PROOF_MOBILE_USER_STATE_REQ_FAIL = "PROOF_MOBILE_USER_STATE_REQ_FAIL"

//类型：认证页-常用app-申请成功
export const PROOF_FREQUENTLY_APPS_USER_STATE_REQ_SUCCESS = "PROOF_FREQUENTLY_APPS_USER_STATE_REQ_SUCCESS"

//类型：认证页-常用app-申请失败
export const PROOF_FREQUENTLY_APPS_USER_STATE_REQ_FAIL = "PROOF_FREQUENTLY_APPS_USER_STATE_REQ_FAIL"

//类型：认证页-人脸-申请成功
export const PROOF_FACE_USER_STATE_REQ_SUCCESS = "PROOF_FACE_USER_STATE_REQ_SUCCESS"

//类型：认证页-人脸-申请失败
export const PROOF_FACE_USER_STATE_REQ_FAIL = "PROOF_FACE_USER_STATE_REQ_FAIL"

//类型：申请页-申请成功
export const APPLY_USER_STATE_REQ_SUCCESS = "APPLY_USER_STATE_REQ_SUCCESS"

//类型：申请页-申请失败
export const APPLY_USER_STATE_REQ_FAIL = "APPLY_USER_STATE_REQ_FAIL"

//类型：审核页-申请成功
export const REVIEW_USER_STATE_REQ_SUCCESS = "REVIEW_USER_STATE_REQ_SUCCESS"

//类型：审核页-申请失败
export const REVIEW_USER_STATE_REQ_FAIL = "REVIEW_USER_STATE_REQ_FAIL"

//类型：拒绝页-申请成功
export const REJECT_USER_STATE_REQ_SUCCESS = "REJECT_USER_STATE_REQ_SUCCESS"

//类型：拒绝页-申请失败
export const REJECT_USER_STATE_REQ_FAIL = "REJECT_USER_STATE_REQ_FAIL"

//类型：放款中页-申请成功
export const LOANING_USER_STATE_REQ_SUCCESS = "LOANING_USER_STATE_REQ_SUCCESS"

//类型：放款中页-申请失败
export const LOANING_USER_STATE_REQ_FAIL = "LOANING_USER_STATE_REQ_FAIL"

//类型：还款页-申请成功
export const REPAY_USER_STATE_REQ_SUCCESS = "REPAY_USER_STATE_REQ_SUCCESS"

//类型：还款页-申请失败
export const REPAY_USER_STATE_REQ_FAIL = "REPAY_USER_STATE_REQ_FAIL"

//类型：引导页-申请成功
export const GUIDE_USER_STATE_REQ_SUCCESS = "GUIDE_USER_STATE_REQ_SUCCESS"

//类型：引导页-申请失败
export const GUIDE_USER_STATE_REQ_FAIL = "GUIDE_USER_STATE_REQ_FAIL"


/** 认证步骤：基本信息 */
export const ProofStepBasic = "personal_info"

/** 认证步骤：工作信息 */
export const ProofStepWork = "work_info"

/** 认证步骤：联系人信息 */
export const ProofStepContact = "contact_info"

/** 认证步骤：号码验证信息 */
export const ProofStepMobile = "mobile_verify"

/** 认证步骤：号码验证信息 */
export const ProofStepFrequentlyUsedApps = "frequently_used_apps"

/** 认证步骤：人脸验证信息 */
export const ProofStepFace = "selfie_invo"

/** 认证步骤：bvn信息 */
export const ProofStepBvn = "bvn_info"

/** 认证步骤：银行卡信息 */
export const ProofStepAccount = "account_info"


/**
 * 判断是否完成所有认证步骤
 * @param {*} list 步骤列表
 * @returns 
 */
export const isAllStepsFinish = list => {
    if (!isNullObject(list)) {
        return !(list.length > 0)
    }

    return true
}

/**
 * 判斷Action是否為选择地址
 * @param {*} action 
 * @returns 
 */
export const isActionAddressPick = action => {
    switch (action) {
        case "ADDRESS_PICK": return true
        default: return false
    }
}

/**
 * 判斷Action是否為选择日期
 * @param {*} action 
 * @returns 
 */
export const isActionDatePick = action => {
    switch (action) {
        case "DATE_PICK": return true
        default: return false
    }
}

/**
 * 判斷Action是否為选择银行
 * @param {*} action 
 * @returns 
 */
export const isActionBankPick = action => {
    switch (action) {
        case "BANK_PICK": return true
        default: return false
    }
}

/**
 * 判斷Action是否為列表选择
 * @param {*} action 
 * @returns 
 */
export const isActionSelect = action => {
    switch (action) {
        case "CONTACT_GROUP_RELATION": return true
        case "CREDIT_REPORT": return true
        case "GENDER_PICK": return true
        case "SELECT": return true
        default: return false
    }
}

/**
 * 判斷Action是否為输入
 * @param {*} action 
 * @returns 
 */
export const isActionInput = action => {
    switch (action) {
        case "INPUT": return true
        case "CONTACT_GROUP_NAME": return true
        case "CONTACT_GROUP_PHONE": return true
        default: return false
    }
}

/**
 * 判斷是否为联系人认证页
 * @param {*} step 
 * @returns 
 */
export const isProofContact = step => {
    switch (step) {
        case ProofStepContact: return true
        default: return false
    }
}

/**
 * 判斷是否为号码认证页
 * @param {*} step 
 * @returns 
 */
export const isProofMobile = step => {
    switch (step) {
        case ProofStepMobile: return true
        default: return false
    }
}

/**
 * 判斷是否为常用app认证页
 * @param {*} step 
 * @returns 
 */
export const isProofFrequentlyUsedApps = step => {
    switch (step) {
        case ProofStepFrequentlyUsedApps: return true
        default: return false
    }
}

/**
 * 判斷是否为人脸认证页
 * @param {*} step 
 * @returns 
 */
export const isProofFace = step => {
    switch (step) {
        case ProofStepFace: return true
        default: return false
    }
}

/**
 * 判斷是否为绑卡认证页
 * @param {*} step 
 * @returns 
 */
export const isProofBankAccount = step => {
    switch (step) {
        case ProofStepAccount: return true
        default: return false
    }
}
